
import { WeaBrowser,WeaRadioGroup} from 'ecCom'
import { Button,message} from 'antd'
import isEqual from 'lodash/isEqual';
import * as mobx from 'mobx';
/**
 * 高级查询
 * props
 * advanceSearchPara ： 高级查询数据
 */
export default class Main extends React.Component{
    constructor(props) {
        super(props);
    }

    shouldComponentUpdate(nextProps) {
        const _c = !isEqual(mobx.toJS(this.props.advanceSearchData), mobx.toJS(nextProps.advanceSearchData));
        return _c || this.props.tabKey !== nextProps.tabKey;
    }

    render(){
        const config = this.getAdvanceSearchConfig();
        return (
            <div className="advance-search-container">
                <WeaRadioGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaRadioGroup@7mqerk`} config={config} onChange={this.doConditonChange.bind(this)}/>
            </div>
        )
    }

    //初始化配置数据
    getAdvanceSearchConfig(){
        const {advanceSearchData,advanceSearchPara = {}} = this.props;
        //更新label
        const {config =[]} = advanceSearchData;
        const ___config  = mobx.toJS(config);
        return ___config;
    }

    doConditonChange(data = {}){
        const {updateAdvanceSearchPara} = this.props;
        updateAdvanceSearchPara && updateAdvanceSearchPara(data);
    }
}